-- 查询全部外键
select *
from SYSCAT.TABCONST
WHERE TABSCHEMA = 'DB2INST1'
and TYPE = 'F';

-- 正确方式
select constname as 外键名称,
       tabname as 从表名称,
       fk_colnames as 从表列名,
       REFKEYNAME as 主键名称,
       reftabname as 主表名称,
       pk_colnames as 主表列名
from syscat.references
where owner = 'DB2INST1';
